# -*- coding: utf-8 -*-
#
# Author:: hanjunfeng
# Date:: 2021/1/4



def list_to_text(_list, filename, separator="\t"):
    f = open(filename, "w", encoding="utf-8")
    for item1 in _list:
        for item2 in item1:
            f.write(str(item2))
            f.write("\t")
        f.write("\n")
    f.close()
def merge_list_keep_old_order(l1=[], l2=[]):
    l3 = l1 + l2
    l4 = list(set(l3))
    l4.sort(key=l3.index)
    return l4

if __name__ == "__main__":
    from submodules.common.lib.local_paths import project_test_data_dir
    import os
    l = [[4, 5, 6], [1, 2, 3]]
    file_name = os.path.join(project_test_data_dir, "list_to_text.txt")
    list_to_text(l, file_name)

    def test_merge_list_keep_old_order():
        l1 = ["a", "b", "c"]
        l2 = ["c", "d", "e"]
        res = merge_list_keep_old_order(l1, l2)
        print(res)


    test_merge_list_keep_old_order()
